package com.example.db;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.*;
import com.example.R;

/**
 * User: wlai
 * Date: 2/18/14
 * Time: 11:27 AM
 */
public class AddRecordActivity extends Activity {
    private Button btnSave;
    private Button btnCancel;
    private EditText money;
    private Spinner category;
    private DatePicker recordTime;
    private DbHelper helper;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_record);

        btnSave = (Button) findViewById(R.id.btnSave);
        btnCancel = (Button) findViewById(R.id.btnCancel);
        money = (EditText) findViewById(R.id.money);
        category = (Spinner) findViewById(R.id.recordCategory);
        recordTime = (DatePicker) findViewById(R.id.recordTime);
        helper=new DbHelper(this);
        category.setAdapter(new SimpleCursorAdapter(AddRecordActivity.this, android.R.layout.simple_spinner_item,
                helper.listCategory(),
                new String[]{CategoryEntry.COLUMN_NAME_CATEGORY_NAME}, new int[]{android.R.id.text1}));

        btnCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AddRecordActivity.this.finish();
            }
        });

        btnSave.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                RecordEntry entry = new RecordEntry();

            }
        });
    }
}